package Data;

/**
 * @Studnet 220207610
 */
public class VerifySuccess {
    Point[][] point;      //魔板中的全部点
    Object[] object;      //方块上应该有的数字顺序或图像顺序

    public void setPoint(Point[][] point) {
        this.point = point;
    }

    public void setObject(Object[] object) {
        this.object = object;
    }
    public boolean isSuccess(){
        if (point[point.length - 1][point[0].length - 1].getBlock() != null){
            //如果右下角有方块
            return false;
        }
        boolean boo = true;
        int k = 0;
        for (int i = 0; i < point.length; i++) {
            if (i < point.length - 1) {
                for (int j = 0; j < point[i].length; j++) {
                    if(!(point[i][j].getBlock().getObject() == object[k])){
                        boo = false;
                        break;
                    }
                    k++;
                }
            }else {   //排除右下角的点
                for (int j = 0; j < point[i].length - 1; j++) {
                    if(!(point[i][j].getBlock().getObject() == object[k])){
                        boo = false;
                        break;
                    }
                    k++;
                }
            }
        }
        return boo;
    }
}
